# frozen_string_literal: true
module Openapi
  module Entities

    class VulnerabilityFeedbackDocument < Grape::Entity
      expose :document_name, documentation: { type: 'String', desc: 'Document Name / 文档名称', example: 'SECURITY.md' }
      expose :document_path, documentation: { type: 'String', desc: 'Document Path / 文档路径', example: '/docs/SECURITY.md' }
      expose :vulnerablity_feedback, documentation: { type: 'String', is_array: true, desc: 'Vulnerability Feedback Methods List / 漏洞反馈方式列表', example: ['GitHub Issue', 'Security Advisory'] }
    end

    class VulnerabilityFeedbackChannelsMetricDetail < Grape::Entity
      expose :vulnerablity_feedback_channels, documentation: { type: 'Boolean', desc: 'Has Vulnerability Feedback Channels / 是否有漏洞反馈渠道', example: true }
      expose :vulnerablity_feedback_channels_list, using: Entities::VulnerabilityFeedbackDocument, documentation: {
        type: 'String',
        desc: 'Vulnerability Feedback Channels List / 漏洞反馈渠道列表',
        param_type: 'body',
        is_array: true
      }
    end

    class VulnerabilityFeedbackChannelsItem < Grape::Entity
      expose :uuid, documentation: { type: 'String', desc: 'Unique ID / 唯一id', example: "a0ddde9c5ad5c6956e5a9662cc4859ad1abaf8b1" }
      expose :level, documentation: { type: 'String', desc: 'Repository Level: repo/community / 仓库层级: 仓库repo/社区community', example: "repo" }
      expose :label, documentation: { type: 'String', desc: 'Repository or Community Label / 仓库或社区标签', example: "https://github.com/oss-compass/compass-web-service" }
      expose :metric_type, documentation: { type: 'String', desc: 'Metric Type / 指标类型', example: "software_artifact_portrait" }
      expose :metric_name, documentation: { type: 'String', desc: 'Metric Name / 指标名称', example: "Vulnerability Feedback Information" }
      expose :metric_detail, using: Entities::VulnerabilityFeedbackChannelsMetricDetail, documentation: { type: 'Entities::VulnerabilityFeedbackChannelsMetricDetail', desc: 'Metric Details / 指标详情', param_type: 'body'}
      expose :version_number, documentation: { type: 'String', desc: 'Version Number / 版本号', example: "v2.0.0" }
      expose :grimoire_creation_date, documentation: { type: 'String', desc: 'Time / 时间', example: "2023-04-12T06:18:01+00:00" }
      expose :metadata__enriched_on, documentation: { type: 'String', desc: 'metadata__enriched_on', example: "2025-01-22T03:27:03.506703+00:00" }
    end

    class VulnerabilityFeedbackChannelsResponse < Grape::Entity
      expose :count, documentation: { type: 'int', desc: 'Total Count / 总数', example: 100 }
      expose :total_page, documentation: { type: 'int', desc: 'Total Pages / 总页数', example: 2 }
      expose :page, documentation: { type: 'int', desc: 'Current Page / 当前页', example: 1 }
      expose :items, using: Entities::VulnerabilityFeedbackChannelsItem, documentation: {
        type: 'Entities::VulnerabilityFeedbackChannelsItem',
        desc: 'response',
        param_type: 'body',
        is_array: true
      }
    end

  end
end
